dnl  -*- Autoconf -*- configuration for CLISP
dnl  Bruno Haible 1992-2008, 2017-2024
dnl  Sam Steingold 2002-2011, 2017
dnl
dnl  configure.in ---<autoconf>--->> configure
dnl               ---<autoheader>->> config.h.in
dnl  configure    ---<sh>--->> config.status
dnl          config.h.in --->> config.h
dnl          intparam.c  --->> intparam.h
dnl          floatparam.c--->> floatparam.h
dnl          makemake.in --->> makemake
dnl
dnl  makemake     ---<sh>--->> Makefile
dnl
dnl  Makefile   ---<make>--->> lisp.run, lispinit.mem
dnl
dnl
AC_PREREQ([2.64])
AC_INIT(GNU CLISP, m4_normalize(m4_esyscmd([if test -f version.sh; then . ./version.sh; else . ../version.sh; fi; echo "${VERSION_NUMBER} (${RELEASE_DATE})"])), http://clisp.org/, clisp)
AC_CONFIG_SRCDIR([lispbibl.d])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([no-define])
AC_COPYRIGHT([GNU CLISP Copyright 1989-2017 by Bruno Haible and others
GNU CLISP is distributed under the GNU GPL v2+, see file COPYRIGHT])dnl
AC_CONFIG_HEADERS(config.h)
dnl
RSE_BOLD
BOLD_MSG([check for host type])
AC_CANONICAL_HOST
CL_DECOLONIZE
BOLD_MSG([checks for programs])
dnl
AC_PROG_CC  dnl sets variable CC
AC_PROG_CPP dnl sets variable CPP
AC_CHECK_TOOL([WINDRES], [windres])
gl_EARLY
AC_LIB_PROG_LD  dnl sets variable LD
AC_PROG_MAKE_SET dnl sets variable SET_MAKE
AC_PROG_INSTALL dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
CL_PROG_LN_S    dnl sets variable LN_S
CL_PROG_HLN     dnl sets variable HLN
LT_INIT([win32-dll])
AC_SUBST(LIBTOOL_DEPS)dnl
AC_PROG_MKDIR_P
AC_CHECK_PROG(GROFF,groff,groff)
AC_CHECK_PROG(PS2PDF,ps2pdf,ps2pdf)
AC_CHECK_PROGS(COMPRESS,gzip zip compress)
dnl
BOLD_MSG([checks for system features])
AC_SYS_LARGEFILE    dnl DEFS _FILE_OFFSET_BITS, _LARGE_FILES
CL_CC_GCC           dnl sets variables CC_GCC, GCC_X_NONE
CL_CC_SUNPRO        dnl sets variable CC_SUNPRO
CL_CC_CPLUSPLUS     dnl sets variable CC_CPLUSPLUS
CL_CC_NEED_DEEMA    dnl sets variable CC_NEED_DEEMA
CL_AS_UNDERSCORE    dnl sets variable AS_UNDERSCORE, DEFS ASM_UNDERSCORE
CL_CC_WORKS         dnl final CC check
dnl
BOLD_MSG([check for add-ons])
gl_INIT
AM_ICONV dnl DEFS HAVE_ICONV, ICONV_CONST, set variable LIBICONV
dnl USE_NLS CPPFLAGS LIBINTL
AM_GNU_GETTEXT([external], [need-ngettext])
CL_FFCALL           dnl set variables LIBAVCALL LIBCALLBACK
CL_LIGHTNING
if test x$with_jitc = xlightning -a $ac_cv_header_lightning_h = no; then
  AC_MSG_ERROR([cannot find gnu lightning])
fi
dnl
BOLD_MSG([checks for fundamental compiler characteristics])
AC_C_INLINE         dnl DEFS inline
CL_BUILTIN_STRLEN   dnl DEFS HAVE_BUILTIN_STRLEN
dnl
BOLD_MSG([checks for header files])
CL_TERM        dnl DEFS HAVE_TERMIOS_H, WINSIZE_NEED_SYS_IOCTL_H
AC_PATH_XTRA   dnl sets variables X_CFLAGS, X_LIBS, X_EXTRA_LIBS, X_PRE_LIBS
test "$ac_cv_lib_socket_connect" = yes && LIBS="$LIBS -lsocket"
test "$ac_cv_lib_nsl_gethostbyname" = yes && LIBS="$LIBS -lnsl"
dnl
BOLD_MSG([checks for typedefs])
AC_CHECK_SIZEOF([off_t])
AC_CHECK_SIZEOF(struct timeval,,[#include <stdio.h>
#include <sys/time.h>])
dnl
BOLD_MSG([checks for structure members])
dnl
AC_CHECK_MEMBERS([struct dirent.d_namlen],,,[#include <dirent.h>])
dnl
BOLD_MSG([checks for functions and declarations])
dnl
AC_FUNC_ALLOCA dnl set variable ALLOCA, DEFS NO_ALLOCA
CL_SETJMP      dnl DEFS HAVE__JMP, LONGJMP_RETURNS
CL_SIGNAL_REINSTALL dnl DEFS SIGNAL_NEED_REINSTALL
CL_SIGNAL_UNBLOCK   dnl DEFS SIGNAL_NEED_UNBLOCK
CL_SIGNAL_BLOCK_OTHERS dnl DEFS SIGNAL_NEED_UNBLOCK_OTHERS
CL_SIGACTION           dnl DEFS HAVE_SIGACTION
CL_SIGACTION_REINSTALL dnl DEFS SIGACTION_NEED_REINSTALL
CL_SIGACTION_UNBLOCK   dnl DEFS SIGACTION_NEED_UNBLOCK
CL_SIGINTERRUPT        dnl DEFS HAVE_SIGINTERRUPT
AC_CHECK_FUNCS(strerror sysconf getdtablesize memset setsid setpgid fchmod dnl
fsync flock gethostent shutdown usleep ualarm setitimer nice ftime realpath dnl
getresuid setresuid getresgid setresgid setreuid setregid dnl
gethostname getcwd getrlimit uname readdir_r rand_r)
AC_FUNC_FORK dnl DEFS HAVE_VFORK_H, vfork
CL_RUSAGE dnl DEFS HAVE_SYS_RESOURCE_H, HAVE_GETRUSAGE, HAVE_SYS_TIMES_H
CL_IOCTL dnl DEFS HAVE_IOCTL, HAVE_FIONREAD, NEED_SYS_FILIO_H, NEED_SYS_IOCTL_H, HAVE_RELIABLE_FIONREAD
CL_POLL dnl DEFS HAVE_POLL, HAVE_RELIABLE_POLL
CL_SELECT dnl DEFS HAVE_SELECT, SELECT_WIDTH_T, SELECT_SET_T, SELECT_CONST, HAVE_RELIABLE_SELECT
CL_GETHOSTBYNAME dnl DEFS HAVE_GETHOSTBYNAME
CL_UNIXCONN dnl DEFS HAVE_SYS_UN_H, HAVE_SOCKADDR_UN_LEN
dnl DEFS HAVE_IPV4, HAVE_IPV6, IPV6_NEED_LINUX_IN6_H, HAVE_NETINET_TCP_H,
dnl SETSOCKOPT_CONST, SETSOCKOPT_ARG_T, SETSOCKOPT_OPTLEN_T, HAVE_SETSOCKOPT
CL_TCPCONN
dnl DEFS CODE_ADDRESS_RANGE, MALLOC_ADDRESS_RANGE, SHLIB_ADDRESS_RANGE,
dnl STACK_ADDRESS_RANGE
CL_ADDRESS_RANGE
CL_VADVISE dnl DEFS HAVE_VADVISE
dnl DEFS HAVE_MMAP, HAVE_MMAP_ANON, HAVE_MMAP_ANONYMOUS
CL_MMAP
AC_CHECK_FUNCS([mincore]) dnl DEFS HAVE_MINCORE
CL_MUNMAP   dnl DEFS HAVE_MUNMAP
CL_MPROTECT dnl DEFS HAVE_MPROTECT, HAVE_WORKING_MPROTECT
CL_DYNLOAD  dnl DEFS HAVE_DLOPEN
gl_FCNTL_O_FLAGS dnl DEFS HAVE_WORKING_O_NOFOLLOW & HAVE_WORKING_O_NOATIME
dnl
BOLD_MSG([checks for libraries])
CL_TERMCAP dnl set variable LIBTERMCAP
CL_READLINE dnl DEFS HAVE_READLINE
dnl
BOLD_MSG([checks for OS services])
CL_FILECHARSET dnl DEFS VALID_FILENAME_CHAR
dnl
BOLD_MSG([checks for compiler characteristics (arithmetic data types)])
dnl
AC_C_CHAR_UNSIGNED dnl DEFS __CHAR_UNSIGNED__ if char is unsigned
dnl DEFS FLOAT_DIV0_EXCEPTION, FLOAT_OVERFLOW_EXCEPTION,
dnl      FLOAT_UNDERFLOW_EXCEPTION, FLOAT_INEXACT_EXCEPTION
CL_FLOAT_DIV0
CL_FLOAT_OVERFLOW
CL_FLOAT_UNDERFLOW
CL_FLOAT_INEXACT
dnl DEFS DOUBLE_DIV0_EXCEPTION, DOUBLE_OVERFLOW_EXCEPTION,
dnl      DOUBLE_UNDERFLOW_EXCEPTION, DOUBLE_INEXACT_EXCEPTION
CL_DOUBLE_DIV0
CL_DOUBLE_OVERFLOW
CL_DOUBLE_UNDERFLOW
CL_DOUBLE_INEXACT
dnl builds intparam.h
CL_MACHINE([integer types and behaviour],
${srcdir}/intparam.c,[CL_INTPARAM_CROSS],intparam.h,cl_cv_file_intparam_h)
dnl builds floatparam.h
CL_MACHINE([floating-point types and behaviour],
${srcdir}/floatparam.c,[CL_FLOATPARAM_CROSS],floatparam.h,cl_cv_file_floatparam_h)
dnl
BOLD_MSG([output file generation])
dnl
dnl gettext po files
dnl
AC_SUBST(PACKAGE)dnl
PACKAGE="clisp"
AC_CONFIG_FILES([po/Makefile.in gllib/Makefile])
dnl
dnl
AC_SUBST([SHELL])
AC_SUBST([module_configure_flags], ["$ac_configure_args"])
AC_CONFIG_FILES([makemake], [chmod a+x makemake])
if test "${srcdir}" = .; then
  AC_CONFIG_FILES([../Makefile])
fi
AC_OUTPUT
